﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using AcctrueWMS.Foundation.Web;
using AcctrueWMS.Foundation.Data;
using System.Reflection;
using AcctrueWMS.Foundation.Web.Modules;

namespace AcctrueWMS.Web.Service
{
    public class UserPermissionManager
    {
        static Type classType;
        static object instance;
        static UserPermissionManager()
        {
            ClsAlias alias = Runtime.ClsAliasManager.GetReal("UserManager");
            classType = Type.GetType(alias.RealName);
            instance = Activator.CreateInstance(classType);
        }
        /// <summary>
        /// 登录
        /// </summary>
        /// <param name="userName"></param>
        /// <param name="password"></param>
        /// <param name="message"></param>
        /// <returns></returns>
        public static SystemUser Login(string userName, string password, out string message)
        {
            message = string.Empty;
            MethodInfo method = classType.GetMethod("ValidateLogin");
            object[] result = new object[] { userName, password, message };
            SystemUser user = method.Invoke(instance, result) as SystemUser;
            message = result[2].ToString();
            return user;
        }
      
    }
}